#ifndef LST_TIMER_HPP
#define LST_TIMER_HPP

#include <time.h>
#include <memory>
#include <sys/socket.h>
#include <netinet/in.h>

const int BUF_SIZE = 64;
class util_timer;

struct client_data
{
    util_timer* timer;
    sockaddr_in address;
    int sockfd;
    char buf[BUF_SIZE];
};

class util_timer
{
public:
    util_timer():prev(NULL),next(NULL){}

public:
    time_t exprie;
    void (*callback)(client_data*);
    client_data* usr_data;
    std::shared_ptr<util_timer> prev;
    std::shared_ptr<util_timer> next;
};

class sort_time_lst
{
public:
    void add_timer(const std::shared_ptr<util_timer> timer);
private:
    std::shared_ptr<util_timer> head;
    std::shared_ptr<util_timer> tail;
};


#endif //LST_TIMER_HPP
